/**
 * Copyright (C)  2011  chen wei hua.
 * Permission is granted to copy, distribute and/or modify this document
 * under the terms of the GNU Free Documentation License, Version 2.0
 * or any later version published by the Free Software Foundation;
 * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 * A copy of the license is included in the section entitled "GNU Free Documentation License".
 */
package com.javaeye.delivery.web;

import java.util.List;

import com.javaeye.delivery.dto.OrderCheck;
import com.javaeye.delivery.service.CheckOrderService;
import com.javaeye.delivery.service.IOrderService;

public class CheckOrderAction extends OrderAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7408989332825417843L;

	private OrderCheck checkResult;
	
	private List<OrderCheck> checkResults;
	
	private CheckOrderService checkOrderService;
	
	/**
	 * 查询需要检验的出货单列表
	 * @return
	 * @throws Exception
	 */
	public String queryCheckList() throws Exception {
		getCondition().setStatus(new Object[]{IOrderService.ORDER_STATES_IN_STORE, IOrderService.ORDER_STATES_CHECKED});
		return queryOrderList();
	}
	
	/**
	 * 查询用于检验
	 * @return
	 * @throws Exception
	 */
	public String queryOrderForCheck() throws Exception {
		return queryOrderBaseInfo();
	}
	
	/**
	 * 查询检验结果
	 * @return
	 * @throws Exception
	 */
	public String queryOrderCheckResult() throws Exception {
		queryOrderBaseInfo();
		checkResults = checkOrderService.getCheckResult(getOrderId());
		return SUCCESS;
	}
	
	/**
	 * 保存检验结果
	 * @return
	 * @throws Exception
	 */
	public String saveOrderCheck() throws Exception {
		checkOrderService.saveCheckResult(checkResult);
		return SUCCESS;
	}

	public OrderCheck getCheckResult() {
		return checkResult;
	}

	public void setCheckResult(OrderCheck checkResult) {
		this.checkResult = checkResult;
	}

	public CheckOrderService getCheckOrderService() {
		return checkOrderService;
	}

	public void setCheckOrderService(CheckOrderService checkOrderService) {
		this.checkOrderService = checkOrderService;
	}

	public void setCheckResults(List<OrderCheck> checkResults) {
		this.checkResults = checkResults;
	}

	public List<OrderCheck> getCheckResults() {
		return checkResults;
	}
	
	
}
